package com.eventapp.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import com.fasterxml.jackson.annotation.JsonIgnore;

@Entity
@Table(name="events")
@Inheritance(strategy = InheritanceType.JOINED)
@Access(AccessType.FIELD)
@XmlRootElement
public abstract class Event extends BaseObject implements Serializable
{
   /** Default value included to remove warning. Remove or modify at will. **/
   private static final long serialVersionUID = 1L;

   @Id
   @GeneratedValue
   @Column(name="id")
   protected Long id;
   protected String name;
   @ManyToOne(fetch=FetchType.EAGER)
   @JoinColumn(name="ownerId")
   protected User owner;   
   protected Date date;   
   protected String info;  
   protected String place;  
   protected String picPath;  
   protected Date startTime; 
   protected Date endTime;

public Date getDate() {
	return date;
} 



public Long getId() {
      return id;
   }


public String getInfo() {
	return info;
}

public String getName() {
      return name;
   }

   public User getOwner() {
	return owner;
}
   
   @XmlTransient
   @JsonIgnore
   public Byte[] getPic(){
		 //TODO: return picture as an array of bytes using picPath.
		 return null;
}

   public String getPicPath() {
	return picPath;
}

public String getPlace() {
	return place;
}

public void setDate(Date date) {
	this.date = date;
}

public void setId(Long id) {
      this.id = id;
   }

public void setInfo(String info) {
	this.info = info;
}

public void setName(String name) {
      this.name = name;
   }

public void setOwner(User owner) {
	this.owner = owner;
}

public void setPicPath(String picPath) {
	this.picPath = picPath;
}


public void setPlace(String place) {
	this.place = place;
}



public Date getStartTime() {
	return startTime;
}



public void setStartTime(Date startTime) {
	this.startTime = startTime;
}

public Date getEndTime() {
	return endTime;
}

public void setEndTime(Date endTime) {
	this.endTime = endTime;
}
   
   
}